<%@page import="net.tanesha.recaptcha.ReCaptchaFactory"%>
<%@page import="net.tanesha.recaptcha.ReCaptcha"%>
<%@page import="articles.model.Category"%>
<%@page import="java.util.List"%>
<%@page contentType="text/html;charset=UTF-8" language="java"%>

<%
	List<Category> list_category = (List<Category>)request.getAttribute("list_category");
	String[] check = (String[]) request.getAttribute("check");
	String[] data = (String[]) request.getAttribute("data");
	String title = (String) request.getAttribute("title");
	String description = (String) request.getAttribute("description");
	String keywords = (String) request.getAttribute("keyword");
	List<Category> category = (List<Category>)request.getAttribute("category");
%>
<jsp:include page="layout/header.jsp">
	<jsp:param name="title" value="<%=title %>"/>
	<jsp:param name="description" value="<%=description %>"/>
	<jsp:param name="keywords" value="<%=keywords %>"/>
</jsp:include>
		<div class="content">
			
			<jsp:include page="element/left.jsp">
				<jsp:param name="title_url" value="abc"/>
			</jsp:include>
			
			<div class="show">
				<h2>Enviar um artigo</h2>
				<jsp:include page="element/adv_one.jsp"></jsp:include>
				<hr size="1"/>
				<p>Envie seu artigo para <b> Yooarticles.com </ b>, preencha o formulário abaixo. Por favor, inclua uma breve biografia de si mesmo, que destaca o seu campo de expertise nome, empresa, experiência (se houver), endereço do site eo seu endereço de e-mail. Estas informações serão usadas para o "Sobre o autor" caixa. Por favor, também ter tempo para ler a concordância do autor antes de submeter seu artigo.</p>	
				<hr size="1"/>
				<form action="/post-articles" method="post">
					<ul class="submit">
						<li>
							<h3>Nome completo do autor:</h3>
							<input name="author" type="text" value="<%=(data[0] != null)?data[0]:"" %>" <%=(check[0] != null)?"style='border:1px solid red;'":"" %>/>
							<%=(check[0] != null)?"<p style='color:red;'>"+check[0]+"</p>":"" %>
						</li>
						<li>
							<h3>Endereço do autor E-mail:</h3>
							<input name="email" type="text" value="<%=(data[1] != null)?data[1]:"" %>" <%=(check[4] != null)?"style='border:1px solid red;'":"" %>/>
							<%=(check[4] != null)?"<p style='color:red;'>"+check[4]+"</p>":"" %>
						</li>
						<li>
							<h3>Título do Artigo:</h3>
							<input name="title" type="text" value="<%=(data[2] != null)?data[2]:"" %>" <%=(check[5] != null || check[6] != null)?"style='border:1px solid red;'":"" %>/>
							<%=(check[5] != null)?"<p style='color:red;'>"+check[5]+"</p>":"" %>
							<%=(check[6] != null)?"<p style='color:red;'>"+check[6]+"</p>":"" %>
						</li>
						<li>
							<h3>Coloque este artigo em que categoria? </h3>
							<select size="6" name="categoryAlias" <%=(check[1] != null)?"style='border:1px solid red;'":"" %>>
								<option value="" selected="selected">Escolha uma</option>
								<option value="">---------------------------------------------------------------------</option>
								<%
									if(list_category.size()>0)
									{
										for(int i=0;i<list_category.size();i++)
										{
											if(data[3] != null && data[3].equals(list_category.get(i).getAlias()))
											{
												out.println("<option value='"+list_category.get(i).getAlias()+"' selected='selected'>"+list_category.get(i).getName()+"</option>");
											} else {
												out.println("<option value='"+list_category.get(i).getAlias()+"'>"+list_category.get(i).getName()+"</option>");
											}
										}
									}
								%>
							</select>
							<%=(check[1] != null)?"<p style='color:red;'>"+check[1]+"</p>":"" %>
						</li>
						<li>
							<h3>conteúdo:</h3>
							<textarea class="a_c" name="content" <%=(check[2] != null)?"style='border:1px solid red;'":"" %>><%=(data[5] != null)?data[5]:""%></textarea>
							<%=(check[2] != null)?"<p style='color:red;'>"+check[2]+"</p>":"<p>Minimum 500 charracter</p>" %>
						</li>
						<li>
							<h3>palavra chave: </h3>
							<input name="keyword" type="text" value="<%=(data[6] != null)?data[6]:"" %>"/>
							<p>Máxima palavra-chave 5, exemplo: chave1, chave2, ...</p>
						</li>
						<li>
							<h3>Endereço do autor do site Web: </h3>
							<input name="link" type="text" value="<%=(data[7] != null)?data[7]:"" %>"/>
						</li>
						<li>
							<h3>Vídeo Link: </h3>
							<input name="linkEmbed" type="text" value="<%=(data[8] != null)?data[8]:"" %>"/>
						</li>
						<li>
							<script>
					        	var RecaptchaOptions = { theme : 'clean' };
					  		</script>
							<%
								//6LdXmcISAAAAAHz6FsABghup-EayldUCiKQyDPAk //public
								//6LdXmcISAAAAANPIv5ykGg3LAlBMnUQHzy3-Kiqo //private
					          ReCaptcha c = ReCaptchaFactory.newReCaptcha("6LfC6MQSAAAAAEzUE11jE1fXoYLuSMceKL4fTCQU", "6LfC6MQSAAAAABJoNxDLux0cFOI40N4ZRuR58ssX", false);
					          out.print(c.createRecaptchaHtml(null, null));
					        %>
					        <%=(check[7] != null)?"<p style='color:red;'>"+check[7]+"</p>":"" %>
						</li>
						<li>
							<input type="submit" value="Submit Articles"/>
						</li>
					</ul>
				</form>
				<br/>
				<div class="info_author">
				<center><jsp:include page="element/adv_four.jsp"></jsp:include></center>
				</div>
			</div>
			<div class="related">
				<ul class="show_t_r">
					<%
						String alias = "";
						if(category != null)
						{
							alias = category.get(0).getAlias();
						}
					%>
					<jsp:include page="element/new_tag.jsp"></jsp:include>
					
					<jsp:include page="element/top_view.jsp">
						<jsp:param name="alias" value="<%=alias %>"/>
					</jsp:include>
					<jsp:include page="element/top_vote.jsp">
						<jsp:param name="alias" value="<%=alias %>"/>
					</jsp:include>
				</ul>
			</div>
			<div class="clear"></div>
		</div>
<script type="text/javascript" src="/js/tiny_mce/tiny_mce.js"></script>
<script type="text/javascript" src="/js/mi_submit.js"></script>
<%@ include file='/layout/footer.jsp'%>   